package org.example.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.dao.entity.UserRoles;

import java.math.BigInteger;

@Mapper
public interface UserRolesMapper extends BaseMapper<UserRoles> {


    @Select("SELECT r.role_code " +
            "FROM roles r " +
            "INNER JOIN user_roles ur ON r.role_id = ur.role_id " +
            "WHERE ur.user_id = #{userId}")
    String selectRoleCodeByUserId(@Param("userId") BigInteger userId);
}
